<template>
  <el-dialog v-model="visible" title="新增">
    <el-form :model="form" label-width="120px">
      <el-form-item label="书名">
        <el-input v-model="form.BookName" />
      </el-form-item>
      <el-form-item label="作者">
        <el-input v-model="form.Author" />
      </el-form-item>
      <el-form-item label="类型">
        <el-input v-model="form.TypeName" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="form.Remarks" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">Create</el-button>
        <el-button @click="visible = false">Cancel</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script lang="ts" setup>
import { computed, reactive, getCurrentInstance } from 'vue'
import { addBook } from '../http/index'
const props = defineProps({
  isShow: Boolean,
  editData: Object
})
const form = reactive({
  BookName: '',
  Author: '',
  TypeName: '',
  Remarks: ''
})
const onSubmit = async () => {
  let data = (await addBook({ ...form })).data
  const vueInstance = getCurrentInstance()
  console.log(vueInstance, data)
  //   vueInstance.$message.success(data)
}
const visible = computed(() => props.isShow)
</script>
<style></style>
